import {INCREMENT,DECREMENT} from '../constant'
const initData=0 //初始化状态
export default function count_reducer(prev=initData,action){
  console.log('@',prev,action);
  //从action对象中获取数据以及方法,prev是上一次的值
  const {type,data}=action
  switch (type) {
    case INCREMENT :
      return prev+data
    case DECREMENT :
      return prev-data
    default:
      return prev
  }
  
}